define(function (require, exports, module) {
	var Grid = require("grid");
	
    var instance = {
        initComponent: function (params,widget) {
        	var component = new Grid({
                parentNode: ".J-grid", 
                model : {
                    url : "api/certificatestransfer/query",
                    params: function() {
                    	var subnav=widget.get("subnav");
                        return {
                        	"operateDate":subnav.getValue("dateRange").start,
     						"operateDateEnd":subnav.getValue("dateRange").end,
     						fetchProperties: widget.constant.mainProperties
                        };
                    },
                    columns : [{
        				name:"travelContract.memberCertificates",
        				label:"会员证号",
        				format: "detail",
                        formatparams: {
                            key: "detail",
                            handler: function(index, data, rowEle) {
                            	var pkTravelContract = data.travelContract.pkTravelContract
                            	widget.service.querystatistics({
                            		"pkTravelContract":pkTravelContract,
                            		fetchProperties:"welfareStatisticsViews"
                            	},function(ret){
                            		widget.handler.grid.showDetail(widget,ret,data);
                            	})
                                
                            }
                        }
					},{
        				name:"travelContract.contactNo",
        				label:"合同号"
        			},{						
						name:"travelContract.productRule.product.name",
        				label:"产品",
					},{
        				name:"travelContract.productType.name",
        				label:"产品类型",
        			},{
						name:"assignor.personalInfo.name",
						label:"转让人"
					},{
        				name:"receiver.personalInfo.name",
        				label:"受让人"
					},{
        				name:"transferType.value",
        				label:"转让类型",
        			},{
						name:"operateDate",
						label:"办理日期",
						format:"date"
					}]
                }
            });
            widget.set("grid",component);
        }
    };
    module.exports = instance;
});